/*****************************************
  NAME: uart_test.c
  DESC: UART test
  WWW.YCTEK.COM
 *****************************************/
#include <string.h>
#include "def.h"
#include "option.h"
#include "2410addr.h"
#include "2410lib.h"

#include "Uart_test.h"

#include "Uart0.h"
#include "Uart1.h"

void * func_uart_test[][2]=
{	
	(void *)Test_Uart0_Int,"UART0 int",
	(void *)Test_Uart1_Int,"UART1 int",	
	0,0
};

void Uart_Test(void)
{
	int i;
	
	Uart_Printf("\n======  UART Test program start ======\n");
		
	while(1)
	{
		i=0;
		Uart_Printf("\n\n");
		while(1)
		{ 
			Uart_Printf("%2d:%s",i,func_uart_test[i][1]);
			i++;
			if((int)(func_uart_test[i][0])==0)
			{
				Uart_Printf("\n");
				break;
			}
			if((i%4)==0)
			Uart_Printf("\n");
		}

		Uart_Printf("\nPress Enter key to exit ,or press 0 to test: ");
		i = Uart_GetIntNum();
		if(i==-1) break;
		if(i>=0 && (i<((sizeof(func_uart_test)-1)/8)) )
			( (void (*)(void)) (func_uart_test[i][0]) )();
	}
	
	Uart_Printf("\n====== UART Test program end ======\n");
}




